#ifndef LOGINWINDOW_H
#define LOGINWINDOW_H

#include<QDialog>
#include <QLineEdit>
#include <QPushButton>
#include <QLabel>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QTimer>
#include <QComboBox>

class LoginWindow:public QDialog
{
    Q_OBJECT
public:
    explicit LoginWindow(QWidget *parent=nullptr);
    ~LoginWindow();

private:
    QLineEdit *lineEditUserName;
    QLineEdit *lineEditPassword;
    QPushButton *buttonLogin;
    QLabel *labelTitle;
    QCheckBox *checkBoxRemember;
    QPushButton *buttonTogglePassword;
    QTimer *lockTimer;
    QPushButton *buttonRegister;
    QComboBox *comboBoxUserList;
    QPushButton *buttonCheck;
    QPushButton *buttonClear;
    QPushButton *buttonRetrieve;
    int failedAttempt;

    void setupUI();
    void loadUserList();

private slots:
    void handleLogin();
    void loadSettings();
    void saveSettings(const QString &username, const QString &password, bool checkRemember);
    void loadSettingsForUser(const QString &username);
};

#endif // LOGINWINDOW_H
